webpackJsonp([35],{

/***/ 180:
/***/ (function(module, exports, __webpack_require__) {

	var __vue_script__, __vue_template__
	var __vue_styles__ = {}
	__vue_script__ = __webpack_require__(181)
	if (Object.keys(__vue_script__).some(function (key) { return key !== "default" && key !== "__esModule" })) {
	  console.warn("[vue-loader] html\\dashboard\\vue\\profile-security.vue: named exports in *.vue files are ignored.")}
	__vue_template__ = __webpack_require__(182)
	module.exports = __vue_script__ || {}
	if (module.exports.__esModule) module.exports = module.exports.default
	var __vue_options__ = typeof module.exports === "function" ? (module.exports.options || (module.exports.options = {})) : module.exports
	if (__vue_template__) {
	__vue_options__.template = __vue_template__
	}
	if (!__vue_options__.computed) __vue_options__.computed = {}
	Object.keys(__vue_styles__).forEach(function (key) {
	var module = __vue_styles__[key]
	__vue_options__.computed[key] = function () { return module }
	})
	if (true) {(function () {  module.hot.accept()
	  var hotAPI = __webpack_require__(17)
	  hotAPI.install(__webpack_require__(1), false)
	  if (!hotAPI.compatible) return
	  var id = "_v-77b5fdfc/profile-security.vue"
	  if (!module.hot.data) {
	    hotAPI.createRecord(id, module.exports)
	  } else {
	    hotAPI.update(id, module.exports, __vue_template__)
	  }
	})()}

/***/ }),

/***/ 181:
/***/ (function(module, exports, __webpack_require__) {

	'use strict';

	Object.defineProperty(exports, "__esModule", {
	    value: true
	});

	var _utils = __webpack_require__(40);

	var _utils2 = _interopRequireDefault(_utils);

	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

	exports.default = {
	    data: function data() {
	        return {
	            user: _utils2.default.user(),
	            emailModal: false,
	            passwordModal: false,
	            password: '',
	            repassword: '',
	            email: '',
	            captcha: '',
	            time: 0
	        };
	    },
	    validators: {
	        newEmail: {
	            message: '新邮箱与当前邮箱一样',
	            check: function check(value) {
	                return value != this.vm.user.email;
	            }
	        }
	    },
	    methods: {
	        sendCaptcha: function sendCaptcha() {
	            this.$validate('email', true);
	            if (this.$ef.email.invalid) {
	                return false;
	            }
	            if (this.time > 0) {
	                return false;
	            }
	            var self = this;
	            _utils2.default.post('/user/email/captcha.json', { email: this.email }, function (rs) {
	                self.time = 30;
	                var interval = window.setInterval(function () {
	                    if (self.time > 0) {
	                        self.time--;
	                    } else {
	                        window.clearInterval(interval);
	                    }
	                }, 1000);
	            });
	        },
	        ok: function ok() {
	            this.$validate(true);
	            if (this.$ef.invalid) {
	                return false;
	            }
	            var self = this;
	            _utils2.default.post('/user/email/new.json', { email: this.email, code: this.captcha }, function (rs) {
	                toastr.success('修改成功');
	                self.emailModal = false;
	                self.user.email = self.email;
	                _utils2.default.user(self.user);
	            });
	        },
	        passwordOk: function passwordOk() {
	            this.$validate(true);
	            if (this.$pf.invalid) {
	                return false;
	            }
	            if (this.password != this.repassword) {
	                toastr.error('两次密码不一样');
	                return false;
	            }
	            var self = this;
	            _utils2.default.post('/user/password.json', { password: this.password }, function (rs) {
	                toastr.success('修改成功');
	                self.passwordModal = false;
	            });
	        }
	    }
	};
	// </script>
	// <template>
	// <div class="db-security form">
	//     <h3 class="title">安全设置</h3><br/><br/>
	//     <div class="item">
	//         <div class="col-sm-2">更换邮箱</div>
	//         <div class="col-sm-6">{{user.email}}</div>
	//         <div class="col-sm-2"><input type="button" value="修改" v-on:click="emailModal=true" class="btn btn-info"></div>
	//     </div>
	//     <div class="item">
	//         <div class="col-sm-2">更换密码</div>
	//         <div class="col-sm-6">建议您3个月修改一次</div>
	//         <div class="col-sm-2"><input type="button" value="修改" v-on:click="passwordModal=true" class="btn btn-info"></div>
	//     </div>
	//
	// </div>
	//     <div class="modal" v-cloak v-if="emailModal">
	//         <div class="modal-header">
	//             <i class="iconfont icon-close modal-close" v-on:click="emailModal=false"></i>
	//         </div>
	//         <div class="modal-content">
	//             <validator name="ef">
	//             <div class="modal-layout2 form">
	//                 <p class="title">修改邮箱</p>
	//                 <div class="item">
	//                     <div class="col-sm-12">
	//                         <input type="text" initial="off" v-model="email" tabindex="1" maxlength="45" v-validate:email="['required','email','newEmail']"  class="k1 text" placeholder="请输入新的邮箱"/>
	//                         <p v-cloak class="tip" v-if="$ef.email.invalid">{{$ef.email.errors[0].message}}</p>
	//                     </div>
	//                 </div>
	//
	//                 <div class="item">
	//                     <div class="col-sm-8">
	//                         <input type="text" class="text k1" tabindex="2" initial="off" v-model="captcha" v-validate:captcha="['required']" placeholder="请输入验证码">
	//                         <p v-cloak class="tip" v-if="$ef.captcha.invalid">{{$ef.captcha.errors[0].message}}</p>
	//                     </div>
	//                     <div class="col-sm-4"><button class="btn btn-info k1" v-on:click="sendCaptcha">{{time>0?(time+'s'):'获取验证码'}}</button></div>
	//                 </div>
	//                 <div>
	//                     <div class="ta-c actions">
	//                         <button class="btn btn-info btn-lg" tabindex="4" v-on:click="emailModal=false">取消
	//                         </button>
	//                         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	//                         <button class="btn btn-danger btn-lg" v-on:click="ok" tabindex="3">确定</button>
	//                     </div>
	//                 </div>
	//             </div>
	//             </validator>
	//         </div>
	//     </div>
	//     <div class="modal" v-cloak v-if="passwordModal">
	//         <div class="modal-header">
	//             <i class="iconfont icon-close modal-close" v-on:click="passwordModal=false"></i>
	//         </div>
	//         <div class="modal-content">
	//             <validator name="pf">
	//                 <div class="modal-layout2 form">
	//                     <p class="title">修改密码</p>
	//                     <div class="item">
	//                         <div class="col-sm-12">
	//                             <input type="password" initial="off" v-model="password" tabindex="1" maxlength="45" v-validate:password="{required:true,minlength:{rule:6,message:'请输入最少6位密码'}}"  class="k1 text" placeholder="请输入新的密码"/>
	//                             <p v-cloak class="tip" v-if="$pf.password.invalid">{{$pf.password.errors[0].message}}</p>
	//                         </div>
	//                     </div>
	//                      <div class="item">
	//                         <div class="col-sm-12">
	//                             <input type="password" initial="off" v-model="repassword" tabindex="1" maxlength="45" v-validate:repassword="{required:true,minlength:{rule:6,message:'请输入最少6位密码'}}"  class="k1 text" placeholder="请确认密码"/>
	//                             <p v-cloak class="tip" v-if="$pf.repassword.invalid">{{$pf.repassword.errors[0].message}}</p>
	//                         </div>
	//                     </div>
	//
	//
	//                     <div>
	//                         <div class="ta-c actions">
	//                             <button class="btn btn-info btn-lg" tabindex="4" v-on:click="passwordModal=false">取消
	//                             </button>
	//                             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	//                             <button class="btn btn-danger btn-lg" v-bind:disabled="$pf.invalid" v-on:click="passwordOk" tabindex="3">确定</button>
	//                         </div>
	//                     </div>
	//                 </div>
	//             </validator>
	//         </div>
	//     </div>
	//
	// </template>
	// <script>

/***/ }),

/***/ 182:
/***/ (function(module, exports) {

	module.exports = "\r\n<div class=\"db-security form\">\r\n    <h3 class=\"title\">安全设置</h3><br/><br/>\r\n    <div class=\"item\">\r\n        <div class=\"col-sm-2\">更换邮箱</div>\r\n        <div class=\"col-sm-6\">{{user.email}}</div>\r\n        <div class=\"col-sm-2\"><input type=\"button\" value=\"修改\" v-on:click=\"emailModal=true\" class=\"btn btn-info\"></div>\r\n    </div>\r\n    <div class=\"item\">\r\n        <div class=\"col-sm-2\">更换密码</div>\r\n        <div class=\"col-sm-6\">建议您3个月修改一次</div>\r\n        <div class=\"col-sm-2\"><input type=\"button\" value=\"修改\" v-on:click=\"passwordModal=true\" class=\"btn btn-info\"></div>\r\n    </div>\r\n\r\n</div>\r\n    <div class=\"modal\" v-cloak v-if=\"emailModal\">\r\n        <div class=\"modal-header\">\r\n            <i class=\"iconfont icon-close modal-close\" v-on:click=\"emailModal=false\"></i>\r\n        </div>\r\n        <div class=\"modal-content\">\r\n            <validator name=\"ef\">\r\n            <div class=\"modal-layout2 form\">\r\n                <p class=\"title\">修改邮箱</p>\r\n                <div class=\"item\">\r\n                    <div class=\"col-sm-12\">\r\n                        <input type=\"text\" initial=\"off\" v-model=\"email\" tabindex=\"1\" maxlength=\"45\" v-validate:email=\"['required','email','newEmail']\"  class=\"k1 text\" placeholder=\"请输入新的邮箱\"/>\r\n                        <p v-cloak class=\"tip\" v-if=\"$ef.email.invalid\">{{$ef.email.errors[0].message}}</p>\r\n                    </div>\r\n                </div>\r\n\r\n                <div class=\"item\">\r\n                    <div class=\"col-sm-8\">\r\n                        <input type=\"text\" class=\"text k1\" tabindex=\"2\" initial=\"off\" v-model=\"captcha\" v-validate:captcha=\"['required']\" placeholder=\"请输入验证码\">\r\n                        <p v-cloak class=\"tip\" v-if=\"$ef.captcha.invalid\">{{$ef.captcha.errors[0].message}}</p>\r\n                    </div>\r\n                    <div class=\"col-sm-4\"><button class=\"btn btn-info k1\" v-on:click=\"sendCaptcha\">{{time>0?(time+'s'):'获取验证码'}}</button></div>\r\n                </div>\r\n                <div>\r\n                    <div class=\"ta-c actions\">\r\n                        <button class=\"btn btn-info btn-lg\" tabindex=\"4\" v-on:click=\"emailModal=false\">取消\r\n                        </button>\r\n                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\r\n                        <button class=\"btn btn-danger btn-lg\" v-on:click=\"ok\" tabindex=\"3\">确定</button>\r\n                    </div>\r\n                </div>\r\n            </div>\r\n            </validator>\r\n        </div>\r\n    </div>\r\n    <div class=\"modal\" v-cloak v-if=\"passwordModal\">\r\n        <div class=\"modal-header\">\r\n            <i class=\"iconfont icon-close modal-close\" v-on:click=\"passwordModal=false\"></i>\r\n        </div>\r\n        <div class=\"modal-content\">\r\n            <validator name=\"pf\">\r\n                <div class=\"modal-layout2 form\">\r\n                    <p class=\"title\">修改密码</p>\r\n                    <div class=\"item\">\r\n                        <div class=\"col-sm-12\">\r\n                            <input type=\"password\" initial=\"off\" v-model=\"password\" tabindex=\"1\" maxlength=\"45\" v-validate:password=\"{required:true,minlength:{rule:6,message:'请输入最少6位密码'}}\"  class=\"k1 text\" placeholder=\"请输入新的密码\"/>\r\n                            <p v-cloak class=\"tip\" v-if=\"$pf.password.invalid\">{{$pf.password.errors[0].message}}</p>\r\n                        </div>\r\n                    </div>\r\n                     <div class=\"item\">\r\n                        <div class=\"col-sm-12\">\r\n                            <input type=\"password\" initial=\"off\" v-model=\"repassword\" tabindex=\"1\" maxlength=\"45\" v-validate:repassword=\"{required:true,minlength:{rule:6,message:'请输入最少6位密码'}}\"  class=\"k1 text\" placeholder=\"请确认密码\"/>\r\n                            <p v-cloak class=\"tip\" v-if=\"$pf.repassword.invalid\">{{$pf.repassword.errors[0].message}}</p>\r\n                        </div>\r\n                    </div>\r\n\r\n\r\n                    <div>\r\n                        <div class=\"ta-c actions\">\r\n                            <button class=\"btn btn-info btn-lg\" tabindex=\"4\" v-on:click=\"passwordModal=false\">取消\r\n                            </button>\r\n                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\r\n                            <button class=\"btn btn-danger btn-lg\" v-bind:disabled=\"$pf.invalid\" v-on:click=\"passwordOk\" tabindex=\"3\">确定</button>\r\n                        </div>\r\n                    </div>\r\n                </div>\r\n            </validator>\r\n        </div>\r\n    </div>\r\n\r\n";

/***/ })

});